package org.ring.common.transport;

import java.util.HashMap;
import java.util.Map;

/**

 * @since 2024-07-21 20:51
 */
public class DefaultMessageHandlerRegistry implements HandlerRegistry{

    private static final Map<Class,MessageHandler> handlers = new HashMap();

    public void register(Class type,MessageHandler messageHandler){
        handlers.put(type,messageHandler);
    }

    @Override
    public MessageHandler lookup(Message message) {
        return handlers.get(message.getData().getClass());
    }
}
